home *** CD-ROM | disk | FTP | other *** search
/ Micromanía: 150 Juegos 2010 / 150Juegos_16.iso / Shareware / Shape Smash / shape-smash.swf / scripts / Code / LIB / animators / _wr378.as < prev   
Encoding:
Text File  |  2010-05-14  |  2.2 KB  |  76 lines

  1. package Code.LIB.animators
  2. {
  3.    import Code.LIB._be548;
  4.    import flash.geom.Point;
  5.    
  6.    public class _wr378 extends _do643
  7.    {
  8.       public static const stNone:int = 0;
  9.       
  10.       public static const stMove:int = 1;
  11.       
  12.       public static const stDone:int = 2;
  13.       
  14.       private var iVelocity:Point;
  15.       
  16.       private var iTargetSpeed:Number;
  17.       
  18.       private var iToPoint:Point;
  19.       
  20.       private var iState:int;
  21.       
  22.       private var iTargetCoords:Point;
  23.       
  24.       public function _wr378(param1:_be548)
  25.       {
  26.          super(param1);
  27.       }
  28.       
  29.       override public function _kx70() : Boolean
  30.       {
  31.          return iState == stDone;
  32.       }
  33.       
  34.       override public function animate(param1:Object = null) : void
  35.       {
  36.          iToPoint = new Point(param1.toPoint.x,param1.toPoint.y);
  37.          iVelocity = new Point();
  38.          iTargetCoords = new Point(target._vq458,target._vg471);
  39.          iTargetSpeed = 2;
  40.          iState = stMove;
  41.       }
  42.       
  43.       override public function onEnterFrame() : void
  44.       {
  45.          var _loc1_:Number = NaN;
  46.          super.onEnterFrame();
  47.          switch(iState)
  48.          {
  49.             case stMove:
  50.                _loc1_ = Math.sqrt((iToPoint.x - iTargetCoords.x) * (iToPoint.x - iTargetCoords.x) + (iToPoint.y - iTargetCoords.y) * (iToPoint.y - iTargetCoords.y));
  51.                if(_loc1_ < iTargetSpeed)
  52.                {
  53.                   target._vq458 = iToPoint.x;
  54.                   target._vg471 = iToPoint.y;
  55.                   iState = stDone;
  56.                }
  57.                if(_loc1_ < 150 && iTargetSpeed > 20)
  58.                {
  59.                   iTargetSpeed -= 4;
  60.                }
  61.                else if(_loc1_ > 150 && iTargetSpeed < 40)
  62.                {
  63.                   iTargetSpeed += 1;
  64.                }
  65.                iVelocity.x = iToPoint.x - iTargetCoords.x;
  66.                iVelocity.y = iToPoint.y - iTargetCoords.y;
  67.                iVelocity.normalize(iTargetSpeed);
  68.                iTargetCoords.x += iVelocity.x;
  69.                iTargetCoords.y += iVelocity.y;
  70.                target._xe768(iTargetCoords.x,iTargetCoords.y);
  71.          }
  72.       }
  73.    }
  74. }
  75.  
  76.